﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class cn_common_foot : System.Web.UI.UserControl
{
    protected string ads = "";
    protected int select = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        string sql = "select top 1 * from Whir_U_Advert order by CreateDate desc";
        DataTable dt = Whir.SQLServerDAL.DbHelperSQL.Query(sql).Tables[0];
        if (dt != null && dt.Rows.Count > 0)
        {
            string IsCheck = dt.Rows[0]["IsCheck"].ToString();
            string ImageUrl = dt.Rows[0]["ImageUrl"].ToString();
            string LinkUrl = dt.Rows[0]["LinkUrl"].ToString();
            string Title = dt.Rows[0]["Title"].ToString();

            if (IsCheck.Trim() == "是")
                select = 1;
            else
                select = 0;


            if (!string.IsNullOrEmpty(ImageUrl))
            {
                if(!string.IsNullOrEmpty(LinkUrl))
                {
                    ads = string.Format("<a href='{0}' title='{1}'><img src='{2}'></a>", LinkUrl, Title, Whir.Common.Settings.GetPicServer() + ImageUrl);
                }else
                {
                    ads = string.Format("<img src='{0}'>", Whir.Common.Settings.GetPicServer() + ImageUrl);
                }
            }
            else
            {
                select = 0;
            }
        }
        else
        {
            select = 0;
        }
    }
}
